document.addEventListener('DOMContentLoaded', function() {
    var likesbtn = document.getElementById('likes-btn')
    var likesTol = document.getElementById('likesTol')
    var likes = document.getElementById('likes')
    likesbtn.addEventListener('click', function() {
      fetch(
        '/images/likes/' + likesbtn.dataset.imageid,
        {method: 'POST', body: {}}
      ).then(response => response.json())
      .then(resp => {
        console.log(resp)
        likes.innerHTML = resp.doc.likes,
        likesTol.innerHTML = parseInt(likesTol.textContent) + 1
      })
    })
  })